using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;

namespace PlacementManager
{
    
    public partial class vwEducatorsWVenuesComponent
    {
		//
		// TODO: Add constructor logic here
		//

        /// <summary>
        /// Selects all records from the database table.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<vwEducatorsWVenues> SelectAllWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<vwEducatorsWVenues> listvwEducatorsWVenues = new List<vwEducatorsWVenues>();
            PlacementManager.DAL.vwEducatorsWVenues_DAL o = new PlacementManager.DAL.vwEducatorsWVenues_DAL();

            DataSet ds = o.SelectAllWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listvwEducatorsWVenues.Add(new vwEducatorsWVenues((int)row["Year"], (string)row["PlacementTypeName"], (string)row["FirstName"], (string)row["LastName"], (string)row["JobTitle"], (string)row["EmailAddress"], (string)row["VenueName"], (string)row["UnitCode"], (string)row["UnitName"], (int)row["PlacementTypeId"], (int)row["SemesterId"], (DateTime)row["DateStart"], (DateTime)row["DateEnd"]));
            }

            if (sortExpression == string.Empty)
            {
                sortExpression = "DateCreated desc";
            }

            listvwEducatorsWVenues.Sort(new vwEducatorsWVenuesComparer(sortExpression));
            return listvwEducatorsWVenues;
        }
	}


}
